import * as types from './actionTypes'
import {getServiceInfoAPI} from '../../apis/cms.js'

export const updateHistoryAction = (history) => ({
  type: types.UPDATE_HISTORY,
  history
})

export const updateServiceInfoAction = (data) => ({
  type: types.UPDATE_SERVICEINFO,
  data
})

export const getServiceInfo = () => {
  return async (dispatch) => {
    try {
      const data = await getServiceInfoAPI()
      dispatch(updateServiceInfoAction(data))
    } catch (e) {
      throw e
    }
  }
}
